package cn.com.bluemoon.daps.system.enums;

import java.util.Arrays;

/**
 * "变更类型 1-表变更 2-归档变更-表归档"
 *
 * @author Jarod.Kong
 */

public enum NoticeChangeType {
    TABLE_CHANGE(1, "表变更"),
    ARCHIVE_CHANGE(2, "归档变更");
    private final int code;
    private final String name;

    NoticeChangeType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static NoticeChangeType valueOfCode(Integer code, NoticeChangeType defaultVal) {
        return Arrays.stream(values()).filter(t -> code != null && t.getCode() == code)
                .findFirst().orElse(defaultVal);
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
